/**
 * @author pd
 */
//_dss_editor._command._commandsManager = {};定义到了main.js中
var undolength = 20;
var redolength = 20;
_dss_editor._command._commandsManager.undostack = [];
_dss_editor._command._commandsManager.redostack = [];

_dss_editor._command._commandsManager.doCommand = function(command){	
	if(command instanceof CreateLinkCommand){
		command.canvas.removeSelectionSystem();
	}
	command.doCommand();
	if(this.undostack.length == undolength){
		this.undostack.splice(0, 1);
	}
	this.undostack.push(command);	
};

_dss_editor._command._commandsManager.undoCommand = function(eventObj){
	var command = this.undostack.pop();
	command.undoCommand(eventObj);
	if(this.redostack.length == redolength){
		this.redostack.splice(0, 1);
	}
	this.redostack.push(command);
	eventObj.canvas.update();
};

_dss_editor._command._commandsManager.redoCommand = function(eventObj){
	this.redostack.pop().redoCommand(eventObj);
	eventObj.canvas.update();
};